package com.example.androidautoproject.utils

import android.widget.TextView

object LogHandle {
    fun log(message: String, tvLog: TextView){
        val currentLog = tvLog.text.toString()
        val newLog = ".$message\n$currentLog"
        val lines = newLog.split("\n")
        val maxLines = 15
        val trimmedLog = if(lines.size > maxLines){
            lines.take(maxLines).joinToString("\n")
        }else{
            newLog
        }
        tvLog.text = trimmedLog
    }
}